//
//  GWBaseViewController.m
//  GiftWanted
//
//  Created by lanou on 15/11/6.
//  Copyright © 2015年 陈文杰. All rights reserved.
//

#import "GWBaseViewController.h"

@interface GWBaseViewController ()

@end

@implementation GWBaseViewController
- (UIView *)topView {
    
    if (!_topView) {
        _topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 70)];
//        _topView.backgroundColor = [UIColor colorWithRed:1.000 green:0.379 blue:0.396 alpha:1.000];
        _topView.backgroundColor = [UIColor colorWithRed:0.305 green:0.794 blue:1.000 alpha:1.000];
        
        [_topView addSubview:self.rightButton];
        [_topView addSubview:self.leftButton];
        [_topView addSubview:self.titleLabel];
        [_topView addSubview:self.titleImage];
        [self.view addSubview:_topView];
    }
    return _topView;
}

- (UILabel *)titleLabel {
    
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2 - 100, 35, 200, 30)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:15];
    }
    return _titleLabel;
}

- (UIButton *)rightButton {
    
    if (!_rightButton) {
        _rightButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _rightButton.frame = CGRectMake(SCREEN_WIDTH - 40, 35, 20, 20);
    }
    return _rightButton;
}

- (UIButton *)leftButton {
    
    if (!_leftButton) {
        _leftButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _leftButton.frame = CGRectMake(20, 35, 20, 20);
    }
    return _leftButton;
}

- (UIImageView *)titleImage {
    
    if (!_titleImage) {
        _titleImage = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2-25, 35, 50, 30)];
    }
    return _titleImage;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"%@", self.topView);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
